﻿Imports Microsoft.VisualBasic.CompilerServices
Imports System

Namespace Stickam_Client
    Public Class RoomlistClass
        ' Methods
        Public Sub add(ByVal name As Object, ByVal id As Object, ByVal population As Object, ByVal created As Object, ByVal isPrivate As Object, ByVal isProtected As Object, ByVal isFlagged As Object)
            Me.ArrayRoomCreated = DirectCast(Utils.CopyArray(DirectCast(Me.ArrayRoomCreated, Array), New String((Me.total + 1)  - 1) {}), String())
            Me.ArrayRoomFlagged = DirectCast(Utils.CopyArray(DirectCast(Me.ArrayRoomFlagged, Array), New String((Me.total + 1)  - 1) {}), String())
            Me.ArrayRoomID = DirectCast(Utils.CopyArray(DirectCast(Me.ArrayRoomID, Array), New String((Me.total + 1)  - 1) {}), String())
            Me.ArrayRoomName = DirectCast(Utils.CopyArray(DirectCast(Me.ArrayRoomName, Array), New String((Me.total + 1)  - 1) {}), String())
            Me.ArrayRoomPopulation = DirectCast(Utils.CopyArray(DirectCast(Me.ArrayRoomPopulation, Array), New String((Me.total + 1)  - 1) {}), String())
            Me.ArrayRoomPrivate = DirectCast(Utils.CopyArray(DirectCast(Me.ArrayRoomPrivate, Array), New String((Me.total + 1)  - 1) {}), String())
            Me.ArrayRoomProtected = DirectCast(Utils.CopyArray(DirectCast(Me.ArrayRoomProtected, Array), New String((Me.total + 1)  - 1) {}), String())
            Me.ArrayRoomCreated(Me.total) = Conversions.ToString(created)
            Me.ArrayRoomFlagged(Me.total) = Conversions.ToString(isFlagged)
            Me.ArrayRoomID(Me.total) = Conversions.ToString(id)
            Me.ArrayRoomName(Me.total) = Conversions.ToString(name)
            Me.ArrayRoomPopulation(Me.total) = Conversions.ToString(population)
            Me.ArrayRoomPrivate(Me.total) = Conversions.ToString(isPrivate)
            Me.ArrayRoomProtected(Me.total) = Conversions.ToString(isProtected)
            Me.total += 1
        End Sub

        Public Sub clear()
            Me.ArrayRoomCreated = New String(1  - 1) {}
            Me.ArrayRoomFlagged = New String(1  - 1) {}
            Me.ArrayRoomID = New String(1  - 1) {}
            Me.ArrayRoomName = New String(1  - 1) {}
            Me.ArrayRoomPopulation = New String(1  - 1) {}
            Me.ArrayRoomPrivate = New String(1  - 1) {}
            Me.ArrayRoomProtected = New String(1  - 1) {}
            Me.total = 0
        End Sub

        Public Function getIndex(ByVal roomID As String) As Integer
            Return Array.IndexOf(Of String)(Me.ArrayRoomID, roomID)
        End Function

        Public Function getParam(ByVal index As Integer, ByVal paramType As Integer) As String
            Dim num As Integer = paramType
            If (num = Me.created) Then
                Return Me.ArrayRoomCreated(index)
            End If
            If (num = Me.id) Then
                Return Me.ArrayRoomID(index)
            End If
            If (num = Me.isFlagged) Then
                Return Me.ArrayRoomFlagged(index)
            End If
            If (num = Me.isPrivate) Then
                Return Me.ArrayRoomPrivate(index)
            End If
            If (num = Me.isProtected) Then
                Return Me.ArrayRoomProtected(index)
            End If
            If (num = Me.name) Then
                Return Me.ArrayRoomName(index)
            End If
            If (num = Me.population) Then
                Return Me.ArrayRoomPopulation(index)
            End If
            Return ""
        End Function


        ' Fields
        Public ArrayRoomCreated As String()
        Public ArrayRoomFlagged As String()
        Public ArrayRoomID As String()
        Public ArrayRoomName As String()
        Public ArrayRoomPopulation As String()
        Public ArrayRoomPrivate As String()
        Public ArrayRoomProtected As String()
        Public created As Integer = 0
        Public id As Integer = 1
        Public isFlagged As Integer = 2
        Public isPrivate As Integer = 3
        Public isProtected As Integer = 4
        Public name As Integer = 5
        Public population As Integer = 6
        Public selectedIndex As Integer = -1
        Public total As Integer
    End Class
End Namespace

